<template>
  <div class="reportFormPage">
    <div class="report-dom">
      <el-row>
        <el-col :span="5" :offset="19">
          <div class="pageNumBox">
            <span>第</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
            <span>页，共</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
            <span>页</span>
          </div>
        </el-col>
      </el-row>
      <div class="topTwoBox">
        <div class="centerName">无机结合料稳定材料配合比设计试验检测报告</div>
        <div class="codeText">
          <tr>
            BGLQ09001F
          </tr>
        </div>
      </div>
      <div class="threeTopBox">
        <div class="left-border">
          <div class="box-title">检测单位名称：</div>
          <div class>{{ form.jiancdwmc }}</div>
        </div>
        <div class="right-border">
          <span>报告编号：</span>
          <span class="placeholder">{{ form.baogbh }}</span>
        </div>
      </div>
      <div class="table-border">
        <!-- .........................1111111111111111111111111111111......................................................... -->
        <table height="160px" class="top-table">
          <tbody>
            <tr>
              <td height="25" class="td-left">
                <span>施工/委托单位</span>
              </td>
              <td width="40%" bgcolor="#ffffff">
                <span>{{ form.shigwtdw }}</span>
              </td>
              <td align="center" class="td-left">
                <span>工程名称</span>
              </td>
              <td bgcolor="#ffffff" width="40%">
                <span>{{ form.gongcmc }}</span>
              </td>
            </tr>
            <tr>
              <td height="30" class="td-left">
                <span>工程部位/用途</span>
              </td>
              <td colspan="3">
                <span>{{ form.gongcbwyt }}</span>
              </td>
            </tr>
            <tr>
              <td height="40" class="td-left">样品信息</td>
              <td class="specimen-border" colspan="3">
                <span>样品名称：</span>
                <span :class="{ placeholder: !form.yangpmc }">{{ form.yangpmc }}</span>
                <span>；样品编号：</span>
                <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>

                <span>；样品数量：</span>
                <span :class="{ placeholder: !form.yangpsl }">{{ form.yangpsl }}</span>
                <span>；样品状态：</span>
                <span :class="{ placeholder: !form.yangpzt }">{{ form.yangpzt }}</span>
                <span>；来样时间：</span>
                <span :class="{ placeholder: !form.yangpsj }">{{ form.yangpsj }}</span>
              </td>
            </tr>
            <tr>
              <td height="40" class="td-left">
                <span>检测依据</span>
              </td>
              <td width="40%">
                <span v-if="isPdf">{{ form.jiancyj }}</span>
                <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark" @dblclick.native="showBsJiancyjView" readonly />
              </td>
              <td align="center" class="td-left">
                <span>判定依据</span>
              </td>
              <td width="40%">
                <span v-if="isPdf">{{ form.pandyj }}</span>
                <el-input v-else type="textarea" v-model="form.pandyj" :rows="2" @dblclick.native="showBsJudgeBaseView" @focus="handleFocus('pandyj')" class="mark" />
              </td>
            </tr>
            <tr class="bottom-border">
              <td height="60" class="td-left">
                <div>主要仪器设备</div>
                <div>名称及编号</div>
              </td>
              <td colspan="3">
                <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh" class="height100 width100 mark" @dblclick.native="showBsInstrumentView" readonly></el-input>
              </td>
            </tr>
          </tbody>
        </table>
        <table height="25px" class="middle-table">
          <tr>
            <td class="td-left">委托编号</td>
            <td width="40%">
              <el-input v-model="form.weitrwbh" />
            </td>
            <td class="td-left">检测类别</td>
            <td width="40%">
              <el-input v-model="form.jianclb" />
            </td>
          </tr>
        </table>
        <!-- .................................22222222222222222222222222222222............................................... -->
        <table height="200px" class="middle-table">
          <tbody>
            <tr>
              <td class="td-left" height="25">矿料名称</td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglmc1 }}</span>
                <el-input v-else type="textarea" v-model="form.kuanglmc1"  @keydown.native="handleKeyDown($event, 0, 0)" :ref="'0_0'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglmc2 }}</span>
                <el-input v-else type="textarea" v-model="form.kuanglmc2"  @keydown.native="handleKeyDown($event, 0, 1)" :ref="'0_1'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglmc3 }}</span>
                <el-input v-else type="textarea" v-model="form.kuanglmc3"  @keydown.native="handleKeyDown($event, 0, 2)" :ref="'0_2'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglmc4 }}</span>
                <el-input v-else type="textarea" v-model="form.kuanglmc4"  @keydown.native="handleKeyDown($event, 0, 3)" :ref="'0_3'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglmc5 }}</span>
                <el-input v-else type="textarea" v-model="form.kuanglmc5"  @keydown.native="handleKeyDown($event, 0, 4)" :ref="'0_4'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglmc6 }}</span>
                <el-input v-else type="textarea" v-model="form.kuanglmc6"  @keydown.native="handleKeyDown($event, 0, 5)" :ref="'0_5'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglmc7 }}</span>
                <el-input v-else type="textarea" v-model="form.kuanglmc7"  @keydown.native="handleKeyDown($event, 0, 6)" :ref="'0_6'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglmc8 }}</span>
                <el-input v-else type="textarea" v-model="form.kuanglmc8"  @keydown.native="handleKeyDown($event, 0, 7)" :ref="'0_7'"/>
              </td>
            </tr>
            <tr>
              <td class="td-left" height="25">矿料比例</td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglbl1 }}</span>
                <el-input v-else v-model="form.kuanglbl1"  @keydown.native="handleKeyDown($event, 1, 0)" :ref="'1_0'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglbl2 }}</span>
                <el-input v-else v-model="form.kuanglbl2"  @keydown.native="handleKeyDown($event, 1, 1)" :ref="'1_1'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglbl3 }}</span>
                <el-input v-else v-model="form.kuanglbl3"  @keydown.native="handleKeyDown($event, 1, 2)" :ref="'1_2'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglbl4 }}</span>
                <el-input v-else v-model="form.kuanglbl4"  @keydown.native="handleKeyDown($event, 1, 3)" :ref="'1_3'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglbl5 }}</span>
                <el-input v-else v-model="form.kuanglbl5"  @keydown.native="handleKeyDown($event, 1, 4)" :ref="'1_4'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglbl6 }}</span>
                <el-input v-else v-model="form.kuanglbl6"  @keydown.native="handleKeyDown($event, 1, 5)" :ref="'1_5'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglbl7 }}</span>
                <el-input v-else v-model="form.kuanglbl7"  @keydown.native="handleKeyDown($event, 1, 6)" :ref="'1_6'"/>
              </td>
              <td colspan="2" class="td2">
                <span v-if="isPdf">{{ form.kuanglbl8 }}</span>
                <el-input v-else v-model="form.kuanglbl8"  @keydown.native="handleKeyDown($event, 1, 7)" :ref="'1_7'"/>
              </td>
            </tr>
            <tr>
              <td class="td-left" height="20">筛孔尺寸</td>
              <td colspan="1" class="td1" v-for="(item, index) in form.baDetailVosA" :key="index">
                {{ item.shaikcc }}
              </td>
            </tr>
            <tr>
              <td class="td-left" height="20">合成级配</td>
              <td colspan="1" class="td1" v-for="(item, index) in form.baDetailVosA" :key="index">
                {{ item.tonggbflPjz }}
              </td>
            </tr>
            <tr>
              <td class="td-left" height="35">规范值</td>
              <td colspan="1" class="td1" v-for="(item, index) in form.baDetailVosA" :key="index">
                <div>{{ item.zuixz }}</div>
                <div>～</div>
                <div>{{ item.zuidz }}</div>
              </td>
            </tr>
            <tr>
              <td rowspan="3" class="td-left">水泥：集料</td>
              <td colspan="4" class="td4" height="20">击实</td>
              <td colspan="7" class="td6">无侧限抗压强度</td>
              <td colspan="5" class="td6">矿质混合料组成曲线图</td>
            </tr>
            <tr>
              <td colspan="2" class="td2" height="30">最佳含水率</td>
              <td colspan="2" class="td2">最大干密度</td>
              <td colspan="1" class="td1">设计值</td>
              <td colspan="1" class="td1">平均值</td>
              <td colspan="1" class="td1">标准差</td>
              <td colspan="1" class="td1">偏差系数</td>
              <td colspan="3" class="td2">无侧限抗压结果</td>
              <td colspan="5" rowspan="5" style="background-color: #ffffff !important">
                <table-line-log-more-chart :className="'echarts-border'" :chartData="chartData" :yMin="0" :yMax="100" :xType="'category'"></table-line-log-more-chart>
              </td>
            </tr>
            <tr>
              <td colspan="2" class="td2" height="20">%</td>
              <td colspan="2" class="td2">g/cm3</td>
              <td colspan="1" class="td1">MPa</td>
              <td colspan="1" class="td1">MPa</td>
              <td colspan="1" class="td1">-</td>
              <td colspan="1" class="td1">-</td>
              <td colspan="3" class="td2">-</td>
            </tr>
            <tr v-show="index < 3" v-for="(item, index) in form.baDetailVosB" :key="index">
              <td class="td-left" height="50">
                <span>{{ item.shuinNum }}</span>
                <span v-show="item.shuinNum">:</span>
                <span>{{ item.jilNum }}</span>
              </td>
              <td colspan="2" class="td2">{{ item.zuijhsl }}</td>
              <td colspan="2" class="td2">{{ item.zuidgmd }}</td>
              <td colspan="1" class="td1">{{ item.shejz }}</td>
              <td colspan="1" class="td1">{{ item.pingjz }}</td>
              <td colspan="1" class="td1">{{ item.biaozc }}</td>
              <td colspan="1" class="td1">{{ item.piancxs }}</td>
              <td colspan="3" class="td2">
                <div v-if="item.jiancjg && item.shejz" class="flex">
                  <span>R</span>
                  <sub>d</sub>
                  <sup>0</sup>
                  <span>={{ item.jiancjg }}</span>
                  <span>{{ item.jiancjg >= item.shejz ? "≥" : "≤" }}</span>
                  <span>R</span>
                  <sub>d</sub>
                  <span>={{ item.shejz }}</span>
                  <span>{{ calculateJiegpd(item.shejz, item.jiancjg) }}</span>
                </div>
              </td>
            </tr>
            <tr>
              <td class="td-left" height="25">延迟时间</td>
              <td class="td1">设计值</td>
              <td class="td1">平均值</td>
              <td class="td1">标准差</td>
              <td class="td1" height="25">偏差系数</td>
              <td class="td2" colspan="2" height="25">无侧限抗压结果</td>
              <td class="td2" colspan="2" height="25">延迟时间</td>
              <td class="td2" colspan="2" height="25">设计值</td>
              <td class="td1" height="25">平均值</td>
              <td class="td1" height="25">标准差</td>
              <td class="td1" height="25">偏差系数</td>
              <td class="td3" colspan="3" height="25">无侧限抗压结果</td>
            </tr>
            <tr>
              <td class="td-left" height="42">延迟{{ form.baDetailVosC[0].yancsj }}小时</td>
              <td class="td1">{{ form.baDetailVosC[0].shejz }}</td>
              <td class="td1">{{ form.baDetailVosC[0].pingjz }}</td>
              <td class="td1">{{ form.baDetailVosC[0].biaozc }}</td>
              <td class="td1">{{ form.baDetailVosC[0].piancxs }}</td>
              <td class="td2" colspan="2">
                <div v-if="form.baDetailVosC[0].jiancjg && form.baDetailVosC[0].shejz" class="flex">
                  <span>R</span>
                  <sub>d</sub>
                  <sup>0</sup>
                  <span>={{ form.baDetailVosC[0].jiancjg }}</span>
                  <span>{{ form.baDetailVosC[0].jiancjg >= form.baDetailVosC[0].shejz ? "≥" : "≤" }}</span>
                  <span>R</span>
                  <sub>d</sub>
                  <span>={{ form.baDetailVosC[0].shejz }}</span>
                  <span>{{ calculateJiegpd(form.baDetailVosC[0].shejz, form.baDetailVosC[0].jiancjg) }}</span>
                </div>
              </td>
              <td class="td2" colspan="2">延迟{{ form.baDetailVosC[3].yancsj }}小时</td>
              <td class="td2" colspan="2">{{ form.baDetailVosC[3].shejz }}</td>
              <td class="td1">{{ form.baDetailVosC[3].pingjz }}</td>
              <td class="td1">{{ form.baDetailVosC[3].biaozc }}</td>
              <td class="td1">{{ form.baDetailVosC[3].piancxs }}</td>
              <td class="td3" colspan="3">
                <div v-if="form.baDetailVosC[3].jiancjg && form.baDetailVosC[3].shejz" class="flex">
                  <span>R</span>
                  <sub>d</sub>
                  <sup>0</sup>
                  <span>={{ form.baDetailVosC[3].jiancjg }}</span>
                  <span>{{ form.baDetailVosC[3].jiancjg >= form.baDetailVosC[3].shejz ? "≥" : "≤" }}</span>
                  <span>R</span>
                  <sub>d</sub>
                  <span>={{ form.baDetailVosC[3].shejz }}</span>
                  <span>{{ calculateJiegpd(form.baDetailVosC[3].shejz, form.baDetailVosC[3].jiancjg) }}</span>
                </div>
              </td>
            </tr>
            <tr>
              <td class="td-left" height="42">延迟{{ form.baDetailVosC[1].yancsj }}小时</td>
              <td class="td1">{{ form.baDetailVosC[1].shejz }}</td>
              <td class="td1">{{ form.baDetailVosC[1].pingjz }}</td>
              <td class="td1">{{ form.baDetailVosC[1].biaozc }}</td>
              <td class="td1">{{ form.baDetailVosC[1].piancxs }}</td>
              <td class="td2" colspan="2">
                <div v-if="form.baDetailVosC[1].jiancjg && form.baDetailVosC[1].shejz" class="flex">
                  <span>R</span>
                  <sub>d</sub>
                  <sup>0</sup>
                  <span>={{ form.baDetailVosC[1].jiancjg }}</span>
                  <span>{{ form.baDetailVosC[1].jiancjg >= form.baDetailVosC[1].shejz ? "≥" : "≤" }}</span>
                  <span>R</span>
                  <sub>d</sub>
                  <span>={{ form.baDetailVosC[1].shejz }}</span>
                  <span>{{ calculateJiegpd(form.baDetailVosC[1].shejz, form.baDetailVosC[1].jiancjg) }}</span>
                </div>
              </td>
              <td class="td2" colspan="2">延迟{{ form.baDetailVosC[4].yancsj }}小时</td>
              <td class="td2" colspan="2">{{ form.baDetailVosC[4].shejz }}</td>
              <td class="td1">{{ form.baDetailVosC[4].pingjz }}</td>
              <td class="td1">{{ form.baDetailVosC[4].biaozc }}</td>
              <td class="td1">{{ form.baDetailVosC[4].piancxs }}</td>
              <td class="td3" colspan="3">
                <div v-if="form.baDetailVosC[4].jiancjg && form.baDetailVosC[4].shejz" class="flex">
                  <span>R</span>
                  <sub>d</sub>
                  <sup>0</sup>
                  <span>={{ form.baDetailVosC[4].jiancjg }}</span>
                  <span>{{ form.baDetailVosC[4].jiancjg >= form.baDetailVosC[4].shejz ? "≥" : "≤" }}</span>
                  <span>R</span>
                  <sub>d</sub>
                  <span>={{ form.baDetailVosC[4].shejz }}</span>
                  <span>{{ calculateJiegpd(form.baDetailVosC[4].shejz, form.baDetailVosC[4].jiancjg) }}</span>
                </div>
              </td>
            </tr>
            <tr>
              <td class="td-left" height="42">延迟{{ form.baDetailVosC[2].yancsj }}小时</td>
              <td class="td1">{{ form.baDetailVosC[2].shejz }}</td>
              <td class="td1">{{ form.baDetailVosC[2].pingjz }}</td>
              <td class="td1">{{ form.baDetailVosC[2].biaozc }}</td>
              <td class="td1">{{ form.baDetailVosC[2].piancxs }}</td>
              <td class="td2" colspan="2">
                <div v-if="form.baDetailVosC[2].jiancjg && form.baDetailVosC[2].shejz" class="flex">
                  <span>R</span>
                  <sub>d</sub>
                  <sup>0</sup>
                  <span>={{ form.baDetailVosC[2].jiancjg }}</span>
                  <span>{{ form.baDetailVosC[2].jiancjg >= form.baDetailVosC[2].shejz ? "≥" : "≤" }}</span>
                  <span>R</span>
                  <sub>d</sub>
                  <span>={{ form.baDetailVosC[2].shejz }}</span>
                  <span>{{ calculateJiegpd(form.baDetailVosC[2].shejz, form.baDetailVosC[2].jiancjg) }}</span>
                </div>
              </td>
              <td class="td2" colspan="2">延迟{{ form.baDetailVosC[5].yancsj }}小时</td>
              <td class="td2" colspan="2">{{ form.baDetailVosC[5].shejz }}</td>
              <td class="td1">{{ form.baDetailVosC[5].pingjz }}</td>
              <td class="td1">{{ form.baDetailVosC[5].biaozc }}</td>
              <td class="td1">{{ form.baDetailVosC[5].piancxs }}</td>
              <td class="td3" colspan="3">
                <div v-if="form.baDetailVosC[5].jiancjg && form.baDetailVosC[5].shejz" class="flex">
                  <span>R</span>
                  <sub>d</sub>
                  <sup>0</sup>
                  <span>={{ form.baDetailVosC[5].jiancjg }}</span>
                  <span>{{ form.baDetailVosC[5].jiancjg >= form.baDetailVosC[5].shejz ? "≥" : "≤" }}</span>
                  <span>R</span>
                  <sub>d</sub>
                  <span>={{ form.baDetailVosC[5].shejz }}</span>
                  <span>{{ calculateJiegpd(form.baDetailVosC[5].shejz, form.baDetailVosC[5].jiancjg) }}</span>
                </div>
              </td>
            </tr>
            <tr>
              <td width="7%" rowspan="2">配合比</td>
              <td class="td3" colspan="3" height="20">水泥剂量</td>
              <td class="td4" colspan="4">最佳含水率</td>
              <td class="td4" colspan="4">最大干密度</td>
              <td class="td6" colspan="6">施工控制压实度</td>
            </tr>
            <tr>
              <td class="td3" colspan="3" height="20">{{ form.shuinjl }}</td>
              <td class="td4" colspan="4">{{ form.zuijhsl }}</td>
              <td class="td4" colspan="4">{{ form.zuidgmd }}</td>
              <td class="td6" colspan="6">{{ form.shigkzysd }}</td>
            </tr>
          </tbody>
        </table>
        <!-- .....................................................33333333333333333................................................... -->
        <table height="80px" class="bottom-table">
          <tr>
            <td colspan="14" height="70px" style="border-bottom-width: 1px">
              <span v-if="isPdf" class="textarea-span">{{ form.jiancjl }}</span>
              <el-input v-else type="textarea" :rows="2" v-model="form.jiancjl" @focus="handleFocus('jiancjl')" @dblclick.native="getJcjl()" />
            </td>
          </tr>
          <tr>
            <td height="70px">
              <span v-if="isPdf" class="textarea-span">{{ form.fujsm }}</span>
              <el-input v-else type="textarea" :rows="2" v-model="form.fujsm" @focus="handleFocus('fujsm')" />
            </td>
          </tr>
        </table>
      </div>
      <!-- .................................44444444444............................................. -->
      <table height="22px" class="transparent">
        <tbody>
          <tr>
            <td width="10%" align="right">检测：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">审核：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">批准：</td>
            <td align="left" width="15%"></td>
            <td width="10%">日期：</td>
            <td align="left" width="15%">
              <div style="display: inline-block; margin-left: 20px">年</div>
              <div style="display: inline-block; margin-left: 20px">月</div>
              <div style="display: inline-block ;margin-left: 20px">日</div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
    <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
    <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType"></bs-judge-base-view>
  </div>
</template>

<script>
import { orderBy } from "lodash";

import { handleFocus, emptyConvert, uniqueStr, handleKeyDown } from "@/views/reportForms/utils";
import { getWjjhlWdclphbsjBsInfo } from "@/api/report_wjjhl/wjjhlWdclphbsjBsInfo";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import TableLineLogMoreChart from "@/views/reportForms/components/TableLineLogMoreChart.vue";

import decimal from "@/utils/big-decimal";
import Bus from "@/utils/bus";
export default {
  name: "wdclphbsj",
  components: {
    BsJudgeBaseView,
    BsInstrumentView,
    BsJiancyjView,
    TableLineLogMoreChart
  },
  props: {
    excelId: {
      type: [String, Number],
      default: () => ""
    },
    syType: {
      type: [String, Number],
      default: () => ""
    },
    page: {
      type: Number,
      default: () => 0
    },
    isPdf: {
      type: Boolean,
      default: () => false
    },
    printEmpty: {
      type: Boolean,
      default: () => false
    }
  },
  data() {
    return {
      // 表单参数
      form: {
        baDetailVosA: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}],
        baDetailVosB: [{}, {}, {}],
        baDetailVosC: [{}, {}, {}, {}, {}, {}]
      },
      chartData: {
        xName: "筛孔尺寸(mm)",
        yName: "通过百分率(%)",
        seriesData: [],
        time: ""
      }
    };
  },
  watch: {
    isPdf(newVal, oldVal) {
      this.form = { ...emptyConvert(this.form, newVal) };
    }
  },
  created() {
    this.getInfo();
  },
  mounted() {
    // 检测依据
    Bus.$on("setWdclycsjBgJiancyj", (data) => {
      const { jiancyj, jiancyjIds } = data;
      const str = jiancyj + (this.form.jiancyj ? "、" + this.form.jiancyj : "");
      const ids = jiancyjIds + (this.form.jiancyjIds ? "," + this.form.jiancyjIds : "");
      this.form.jiancyj = uniqueStr(str, "、");
      this.form.jiancyjIds = uniqueStr(ids, ",");
    });
    // 主要设备
    Bus.$on("setWdclycsjBgZhuyyqsbmcjbh", (data) => {
      const { zhuyyqsbmcjbh, shebIds } = data;
      const str = zhuyyqsbmcjbh + (this.form.zhuyyqsbmcjbh ? "、" + this.form.zhuyyqsbmcjbh : "");
      const ids = shebIds + (this.form.shebIds ? "," + this.form.shebIds : "");
      this.form.zhuyyqsbmcjbh = uniqueStr(str, "、");
      this.form.shebIds = uniqueStr(ids, ",");
    });
    // 筛孔尺寸 来自-粗集料颗粒级配试验检测记录
    Bus.$on("setWdclphbsjBgShaikcc", (data) => {
      const arr = ["shaikcc", "tonggbflPjz", "tonggbfl1", "tonggbfl2", "zuidz", "zuixz"];
      data.forEach((item, index) => {
        arr.forEach((key) => {
          this.form.baDetailVosA[index][key] = item[key];
        });
      });
      this.setEcharts();
    });

    // 无侧限抗压强度 -无机结合料稳定材料无侧限抗压强度试验检测记录表
    Bus.$on("setWdclphbsjBgWcxky", (info) => {
      const { daibz, pingjkyqd, biaozcs, piancxscv } = info;
      this.form.baDetailVosB[0].jiancjg = daibz;
      this.form.baDetailVosB[0].pingjz = pingjkyqd;
      this.form.baDetailVosB[0].biaozc = biaozcs;
      this.form.baDetailVosB[0].piancxs = piancxscv;
    });
    // 延迟时间
    Bus.$on("setWdclphbsjBgYcsj", (info) => {
      const { page, yancsjNum, daibz, shejqd, pingjkyqd, biaozcs, piancxscv } = info;
      this.form.baDetailVosC[page].yancsj = yancsjNum;
      this.form.baDetailVosC[page].jiancjg = daibz;
      this.form.baDetailVosC[page].shejz = shejqd;
      this.form.baDetailVosC[page].pingjz = pingjkyqd;
      this.form.baDetailVosC[page].biaozc = biaozcs;
      this.form.baDetailVosC[page].piancxs = piancxscv;
    });
    // 配合比 -无机结合料稳定材料无侧限抗压强度试验检测记录表
    Bus.$on("setWdclphbsjBgPhb", (info) => {
      const { wendjjl, zuijhsl, zuidgmd, chengxysd, shejqd } = info;
      this.form.shuinjl = wendjjl;
      this.form.zuijhsl = zuijhsl;
      this.form.zuidgmd = zuidgmd;
      this.form.shigkzysd = chengxysd;
      this.form.baDetailVosB[0].shuinNum = wendjjl;
      this.form.baDetailVosB[0].jilNum = 100;
      this.form.baDetailVosB[0].zuijhsl = zuijhsl;
      this.form.baDetailVosB[0].zuidgmd = zuidgmd;
      this.form.baDetailVosB[0].shejz = shejqd;
    });
  },
  beforeDestroy() {
    // 或者你可以使用其他合适的生命周期钩子
    // 停止监听事件
    Bus.$off("setWdclphbsjBgJiancyj");
    Bus.$off("setWdclycsjBgZhuyyqsbmcjbh");
    Bus.$off("setWdclycsjBgTestData");
  },
  methods: {
    // 获取详情
    getInfo() {
      getWjjhlWdclphbsjBsInfo(this.excelId || this.$defaultExcelId).then((response) => {
        this.form = response.data;
        if (!this.form.jiancjl) {
          this.form.jiancjl = "检测结论：";
        }
        if (!this.form.fujsm) {
          this.form.fujsm = "附加声明：";
        }
        this.setEcharts();
      });
    },
    // 显示检测依据列表
    showBsJiancyjView() {
      this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
    },
    // 检测依据选择
    selectJiancyj(info) {
      this.form.jiancyj = info.label;
      this.form.jiancyjIds = info.ids;
    },
    // 显示判定依据列表
    showBsJudgeBaseView() {
      this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
    },
    // 判断依据选择
    selectJudge(info) {
      if (!info || !info.label) {
        return;
      }
      if (!this.form.pandyj) {
        this.form.pandyj = info.label;
      } else {
        if (info && info.label) {
          this.form.pandyj += "、" + info.label;
        }
      }
      // 添加指标 info.list
    },
    // 显示仪器列表
    showBsInstrumentView() {
      this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
    },
    // 仪器选择
    selectInstrument(info) {
      this.form.zhuyyqsbmcjbh = info.label;
      this.form.shebIds = info.ids;
    },
    // 获取检测结论
    getJcjl() {
      const form = JSON.parse(JSON.stringify(this.form));
      queryJcjl(emptyConvert(form)).then((res) => {
        const info = res.data;
        this.form.jiancjl = info.jiancjl;
      });
    },
    // 绘制图表
    setEcharts() {
      if (!this.form.baDetailVosA || this.form.baDetailVosA.length <= 0) {
        return;
      }
      const baDetailVos = this.form.baDetailVosA;
      let data1 = [];
      let data2 = [];
      let data3 = [];
      let list = [];
      baDetailVos.forEach((item) => {
        if (item.shaikcc && item.shaikcc.indexOf("底") == -1) {
          list.push({ shaikcc: Number(item.shaikcc), tonggbfl1: Number(item.tonggbfl1), tonggbfl2: Number(item.tonggbfl2), tonggbflPjz: Number(item.tonggbflPjz) });
        }
      });
      const array = orderBy(list, ["shaikcc", "age"]);
      array.forEach((item) => {
        data1.push([item.shaikcc, item.tonggbfl1]);
        data2.push([item.shaikcc, item.tonggbfl2]);
        data3.push([item.shaikcc, item.tonggbflPjz]);
      });

      const chart1 = {
        data: data1,
        connectNulls: true,
        smooth: false,
        type: "line",
        lineStyle: {
          type: "dotted"
        }
      };
      const chart2 = {
        data: data2,
        connectNulls: true,
        smooth: false,
        type: "line",
        lineStyle: {
          type: "dotted"
        }
      };
      const chart3 = {
        data: data3,
        connectNulls: true,
        smooth: false,
        type: "line"
      };

      this.chartData.seriesData = [chart1, chart2, chart3];
      this.chartData.time = new Date().getTime();
    },
    // 计算结果判定
    calculateJiegpd(shejz, daibz) {
      let jiegpd = null;
      if (shejz && daibz) {
        jiegpd = daibz >= shejz ? "符合" : "不符合";
      }
      return jiegpd;
    },
    submitForm() {
      return this.form;
    },
    handleFocus(event) {
      handleFocus(event, this.page, this.form[event]);
    },
    handleKeyDown(event, rowIndex, colIndex) {
      const maxArr = [7, 7];
      const ref = handleKeyDown(event, rowIndex, colIndex, maxArr);
      if (this.$refs[ref]) {
        this.$refs[ref].focus();
      }
    }
  }
};
</script>

<style scoped>
.middele-td {
  width: calc((100% - 16%) / 7);
}

.td-left {
  width: 10%;
}

.td1 {
  width: calc(89.5% / 16 * 1);
}

.td2 {
  width: calc(89.5% / 16 * 2);
}

.td3 {
  width: calc(89.5% / 16 * 3);
}

.td4 {
  width: calc(89.5% / 16 * 4);
}

.td5 {
  width: calc(89.5% / 16 * 5);
}

.echarts-border {
  width: 170px;
  height: 194px;
  padding: 2px !important;
  background-color: #ffffff !important;
}

.flex {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  align-items: center;
  transform: scale(0.8);
}
</style>
